package cn.tedu.charging.cost.entity.po;


import org.springframework.data.annotation.Id;
import lombok.AccessLevel;
import lombok.Data;
import lombok.experimental.FieldDefaults;
import org.springframework.data.elasticsearch.annotations.Document;

import java.math.BigDecimal;

@Data
@FieldDefaults(level = AccessLevel.PRIVATE)
@Document(indexName = "charging_data_2406")
public class ChargingDataESPO {
    @Id
    String orderNo;
    Integer gunId;
    Integer userId;
    Long startTime;
    Integer count;
    Float chargingDushu;
    BigDecimal totalPrice;


    public void countAdd1(){
        this.count+=1;
    }

    public Float  getDiffDushu(Float chargingDushu){
        return chargingDushu-this.chargingDushu;
    }

    public void addPrice(BigDecimal price){
        this.totalPrice=this.totalPrice.add(price);
    }


    public Long costTime(Long time){
        if (this.startTime==null){
            return time;
        }
         return time-this.startTime;
    }
}
